## PBAR_ExamineRadiography.py

import numpy as np
import csv

datasetNameList = ('Coll-BS-03282013-after-Pb-Al-runs-', 'Coll-BS-03282013-after-Pb-Fe-runs-', \
                   'Coll-BS-03282013-before-Pb-Al-runs-', 'Coll-BS-03282013-before-Pb-Fe-runs-', \
                   'Coll-BS-03292013-after-4Pb-Al-runs-', 'Coll-BS-03292013-before-4Pb-Al-runs-', \
                   'Dark-Coll-BS-03282013-after-Pb-Al-runs-', 'Dark-Coll-BS-03282013-after-Pb-Fe-runs-', \
                   'Dark-Coll-BS-03282013-before-Pb-Al-runs-', 'Dark-Coll-BS-03282013-before-Pb-Fe-runs-', \
                   'dark-current-03292013-after-4Pb-Al-', 'dark-current-03292013-before-4Pb-Al-')

dirPath = r'C:\Users\jkwong\Documents\Work\PBAR\data\Array-Response\\'

datRadCal = []
for ii in range(0, len(datasetNameList)):
    fullfileName = dirPath + datasetNameList[ii] + 'all' + '.csv'
    datRadCal.append(np.genfromtxt(fullfileName, delimiter = ','))


# plot all means

plt.figure()
for ii in range(0,len(datRadCal)):
    plt.plot(datRadCal[ii][:,4], label = datasetNameList[ii])

plt.ylabel('Signal')
plt.xlabel('Detector Number')
plt.legend()


# plot all dark means

plt.figure()
for ii in range(6,len(datRadCal)):
    plt.plot(datRadCal[ii][:,4], label = datasetNameList[ii])

plt.ylabel('Signal')
plt.xlabel('Detector Number')
plt.legend()


# plot all airs

plt.figure()
for ii in range(0,6):
    plt.plot(datRadCal[ii][:,0:4], label = datasetNameList[ii])

plt.ylabel('Signal')
plt.xlabel('Detector Number')
plt.title('Airs')
plt.legend(prop={'size':10})
plt.ylim((0, 1000))



# plot all darks

plt.figure()
for ii in range(6,len(datRadCal)):
    plt.plot(datRadCal[ii][:,0:4], label = datasetNameList[ii])

plt.ylabel('Signal')
plt.xlabel('Detector Number')
plt.title('Darks')
plt.legend(prop={'size':10})
plt.ylim((0, 1000))
